﻿#ifndef MYFRAME_H
#define MYFRAME_H

#include <wx/wxprec.h>

#ifndef WX_PRECOMP
#include <wx/wx.h>
#endif

#include <map>
#include <vector>
#include <fstream>
#include <filesystem>
#include <chrono>
#include <iomanip>
#include <sstream>
#include <ctime>

namespace fs = std::filesystem;

class MyFrame : public wxFrame
{
public:

	MyFrame();

	void RefreshUI();

private:
	std::map<wxString, std::vector<wxString>> fileTypeMap = {
		{
			"Images",
			{".jpg", ".jpeg", ".png", ".gif", ".bmp", ".svg"}
		},
		{
			"Docs",
			{".pdf", ".docx", ".doc", ".xlsx", ".xls", ".pptx", ".ppt", ".txt", ".csv"}
		},
		{
			"Videos",
			{".mp4", ".avi", ".mov", ".mkv", "wmv", "flv"}
		},
		{
			"Audio",
			{".mp3", ".m4a", ".wav", ".flac", ".aac", ".wma"}
		},
		{
			"Exe",
			{".exe", ".bat"}
		},
		{
			"Zip",
			{".zip", ".rar", ".gz", ".7z"}
		}
	};

	wxPanel* mainPanel;
	void CreateUI();

	void OnBtnDirChooser(wxCommandEvent& event);
	void organizeWithLogging(const wxString& directory);
	std::string getTimeStrForFilename();

	bool createDirectory(const std::string& path);
	std::string determineCategory(const std::string& extension);
	bool moveFile(const std::string& source, const std::string& destination);

};

#endif